package day07;


import java.util.Random;
import java.util.Scanner;

public class practice {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        /*System.out.println("猜吧");
        int num =(int)(Math.random()*100+1);
        System.out.println("作弊器："+num);

        while(true){//while语句中的条件直接写为true，造成无限循环，后续达成条件用break跳出循环
            System.out.println("猜吧");
            int guess = scanner.nextInt();//接收用户数据是个循环过程
            if (guess>num){
                System.out.println("猜大了");
            }else if(guess<num){
                System.out.println("猜小了");
            }else{
                System.out.println("恭喜你猜中了");
                break;
            }
        }*/
        Random random=new Random();
        int count =random.nextInt(100);

        while(true){
            System.out.println("猜吧");
            int user = scanner.nextInt();
            if (user>count){
                System.out.println("猜大了");
            }else if(user<count){
                System.out.println("猜小了");
            }else{
                System.out.println("恭喜你猜中了");
                break;
            }
        }







    }
}
